﻿var isIE=false;
/*@cc_on
isIE=true;
@*/

if(isIE)
{
	var HTMLElement = new Function();
	var HTMLFormElement = new Function();
	var HTMLButtonElement = new Function();
	var HTMLDivElement = new Function();
	var HTMLIFrameElement = new Function();
	var HTMLImageElement = new Function();
	var HTMLInputElement = new Function();
	var HTMLLabelElement = new Function();
	var HTMLObjectElement = new Function();
	var HTMLSelectElement = new Function();
	var HTMLTableElement = new Function();
	var HTMLTableSectionElement = new Function();
	var HTMLTableRowElement = new Function();
	var HTMLTableCellElement = new Function();
	var HTMLSpanElement = new Function();
	var HTMLTextAreaElement = new Function();
	var HTMLUnknownElement = new Function();
	document.execCommand("BackgroundImageCache", false, true);
} else if(!window.opera) {
    navigator.userLanguage = navigator.language.toLowerCase();
	window.clipboardData = {
		unSupportException: "当前安全设置不允许进行剪贴板操作，请在地址栏中输入“about:config”将“signed.applets.codebase_principal_support”设置为“true”之后重试",
		setData: function(type, txt) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
			}  
			catch (e) { 
				alert(this.unSupportException); 
				return false; 
			} 
			var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
			if (!clip) {
				return false;
			}
			var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
			if (!trans) {
				return;
			}
			trans.addDataFlavor('text/unicode');
			
			var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
			str.data = txt;
	
			trans.setTransferData("text/unicode", str, txt.length * 2);
			var clipid=Components.interfaces.nsIClipboard;
			if (!clip) {
				return false;
			}
			clip.setData(trans,null,clipid.kGlobalClipboard);
	      		return true;
		},
		getData: function() {
			try { 
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
			}  
			catch (e) { 
				alert(this.unSupportException); 
				return false; 
			} 
			var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
			if (!clip) {
				return null;
			}
			var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
			if (!trans) {
				return null;
			}
			trans.addDataFlavor('text/unicode'); 
			clip.getData(trans,clip.kGlobalClipboard); 
			var str = new Object(); 
			var len = new Object(); 
			try { 
				trans.getTransferData('text/unicode',str,len); 
			} 
			catch(ex) { 
				return null; 
			} 
			if (str) { 
				if (Components.interfaces.nsISupportsWString) {
					str = str.value.QueryInterface(Components.interfaces.nsISupportsWString);
				}
				else if (Components.interfaces.nsISupportsString) {
					str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
				}
				else {
					str = null;
				}
			}
			if (str) {
				return str.data.substring(0,len.value / 2);
			}
			return null;
		}
	}
	function SearchEvent()
	{
		var func=SearchEvent.caller;
		while(func!=null)
		{
			var arg=func.arguments[0];
			if(arg)
			{
				if(String(arg.constructor).indexOf('Event') > -1)
				{
					return arg;
				}
			}
			func=func.caller;
		}
		return null;
	};
	var attachEvent = document.attachEvent = function(eventName,handler)
	{
		window.addEventListener(eventName.substring(2),handler,true);
	};
	var detachEvent = document.detachEvent = function(eventName,handler)
	{
		window.removeEventListener(eventName.substring(2),handler,true)
	};
	window.constructor.prototype.__defineGetter__
	(
		"event",
		function()
		{
			return SearchEvent()
		}
	);
	HTMLUnknownElement.prototype.__defineSetter__
	(
		"src",
		function(value)
		{
			this.load(value);
			return value
		}
	);
	HTMLUnknownElement.prototype.__defineGetter__
	(
		"src",
		function()
		{
			return this.Dom.documentURI
		}
	);
	HTMLUnknownElement.prototype.__defineGetter__
	(
		"XMLDocument",
		function()
		{
			if(this.Dom)
			{
				return this.Dom;
			}
			else
			{
				var src = this.getAttribute("src") || "";
				if(src != "")
				{
					this.load(src)
				}
				else
				{
					var xml = this.innerHTML;
					if(xml.replace(/\s/g,"") != "")
					{
						
						this.loadXML('<?xml version="1.0" ?>' + xml)
					}
					else
					{
						this.loadXML('<?xml version="1.0" ?><root />')
					}
				}
				return this.Dom
			}
		}
	);
	HTMLUnknownElement.prototype.__defineGetter__
	(
		"documentElement",
		function()
		{
			return this.XMLDocument.documentElement
		}
	);
	HTMLUnknownElement.prototype.load = function(src)
	{
		if(!this.Dom)
		{
			this.Dom = document.implementation.createDocument('','',null);
		}
		this.Dom.async = (this.async != false);
		return this.Dom.load(src)
	};
	HTMLUnknownElement.prototype.loadXML = function(xml)
	{
		if(!this.Dom)
		{
			this.Dom = document.implementation.createDocument('','',null)
		}
		return this.Dom.loadXML(xml)
	};
	HTMLElement.prototype.__defineGetter__
	(
		"all",
		function()
		{
			var all = this.getElementsByTagName("*");
			var node = this;
			all.tags = function(sTagName){
				return node.getElementsByTagName(sTagName)
			};
			return all
		}
	);
	HTMLElement.prototype.__defineGetter__
	(
		"parentElement",
		function()
		{
			if(this.parentNode == this.ownerDocument){
				return null
			}
			return this.parentNode
		}
	);
	HTMLElement.prototype.__defineGetter__
	(
		"children",
		function()
		{
			var tmp=[];
			var j=0;
			var n;
			for(var i=0;i<this.childNodes.length;i++)
			{
				n=this.childNodes[i];
				if(n.nodeType==1)
				{
					tmp[j++]=n;
					if(n.name)
					{
						if(!tmp[n.name])
						{
							tmp[n.name]=n;
							continue
						}
						else if(tmp[n.name].constructor != Array)
						{
							tmp[n.name] = [tmp[n.name]];
						}
						tmp[n.name].push(n)
					}
					if(n.id)
					{
						if(!tmp[n.id])
						{
							tmp[n.id]=n
						}
						else if(n.id == n.name)
						{
							tmp[n.id]=tmp[n.name]
						}
					}
				}
			}
			return tmp
		}
	);
	HTMLElement.prototype.__defineGetter__
	(
		"runtimeStyle",
		function()
		{
			return this.style;
		}
	);
	HTMLElement.prototype.__defineGetter__
	(
		"currentStyle",
		function()
		{
			return this.ownerDocument.defaultView.getComputedStyle(this,null)
		}
	);
	HTMLElement.prototype.__defineSetter__
	(
		"outerHTML",
		function(value)
		{
			var r=this.ownerDocument.createRange();
			r.setStartBefore(this);
			var df=r.createContextualFragment(value);
			this.parentNode.replaceChild(df,this);
			return value
		}
	);
	HTMLElement.prototype.__defineGetter__
	(
		"outerHTML",
		function()
		{
			var attr;
			var attrs=this.attributes;
			var str="<"+this.tagName;
			for(var i=0;i<attrs.length;i++)
			{
				attr=attrs[i];
				if(attr.specified)
				{
					str+=" "+attr.name+'="'+attr.value+'"'
				}
			}
			if(!this.canHaveChildren)
			{
				return str+">"
			}
			return str+">"+this.innerHTML+"</"+this.tagName+">"
		}
	);
	HTMLElement.prototype.__defineGetter__
	(
		"canHaveChildren",
		function()
		{
			switch(this.tagName.toLowerCase()){
				case "area":
				case "base":
				case "basefont":
				case "col":
				case "frame":
				case "hr":
				case "img":
				case "br":
				case "input":
				case "isindex":
				case "link":
				case "meta":
				case "param":
				return false;
			}
			return true
		}
	);
	HTMLElement.prototype.__defineSetter__
	(
		"innerText",
		function (value) 
		{
			this.innerHTML = "";
			var sText = String(value);
			var textS = sText.split("\n");
			var hCount = textS.length - 1;
			for(var i=0; i <= hCount ; i++)
			{
				var txtNode = null;
				var retNode = null;
				if(textS[i].length)
				{
					txtNode = document.createTextNode(textS[i])
				}
				if(i < hCount)
				{
					retNode = document.createElement("BR")
				}
				if(txtNode)
				{
					this.appendChild(txtNode)
				}
				if(retNode)
				{
					this.appendChild(retNode)
				}
			}
			this.innerHTML = this.innerHTML.replace(/\s*$/g,"").replace(/\s/g,"&nbsp;");
			return value
		}
	);
	HTMLElement.prototype.__defineGetter__
	(
		"innerText",
		function () 
		{
			var innerText = "";
			var childS = this.childNodes;
			for(var i=0; i < childS.length ; i++)
			{
				if(childS[i].nodeType==1)
				{
					innerText += childS[i].tagName=="BR" ? '\n' : childS[i].innerText
				}
				else if(childS[i].nodeType==3)
				{
					innerText += childS[i].nodeValue
				}
			}
			return innerText;
		}
	);
	HTMLElement.prototype.__defineSetter__
	(
		"outerText",
		function(value)
		{
			var parsedText = document.createTextNode(value);
			this.outerHTML = parsedText;
			return parsedText
		}
	);
	HTMLElement.prototype.__defineGetter__
	(
		"outerText",
		function()
		{
			var r=this.createRange();
			r.selectNodeContents(this);
			return r.toString()
		}
	);
	HTMLElement.prototype.createRange = function(){
		return this.ownerDocument.createRange()
	};
	
	HTMLElement.prototype.createTextRange = function(txtStr){
		return this.ownerDocument.createTextRange(txtStr)
	};
	HTMLElement.prototype.attachEvent = function(eventName,handler)
	{
		this.addEventListener(eventName.substring(2),handler,true)
	};
	HTMLElement.prototype.detachEvent = function(eventName,handler)
	{
		this.removeEventListener(eventName.substring(2),handler,true)
	};
	HTMLElement.prototype.contains = function(ele)
	{
		do
		{
			if(ele==this)
			{
				return true
			}
		}while(ele = ele.parentNode);
		return false
	};
	HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode)
	{
		switch(where)
		{
			case "beforeBegin":
				this.parentNode.insertBefore(parsedNode,this);
				break;
			case "afterBegin":
				this.insertBefore(parsedNode,this.firstChild);
				break;
			case "beforeEnd":
				this.appendChild(parsedNode);
				break;
			case "afterEnd":
				if(this.nextSibling)
				{
					this.parentNode.insertBefore(parsedNode,this.nextSibling)
				}
				else
				{
					this.parentNode.appendChild(parsedNode)
				}
                		break;
		}
	};
	HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr)
	{
		var r=this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	};
	HTMLElement.prototype.insertAdjacentText = function(where,txtStr)
	{
		var parsedText=document.createTextNode(txtStr);
		this.insertAdjacentElement(where,parsedText)
	};
	Event.prototype.__defineGetter__
	(
		"button",
		function()
		{
			return this.button + 1
		}
	);
	Event.prototype.__defineGetter__
	(
		"clientX",
		function()
		{
			return this.pageX
		}
	);
	Event.prototype.__defineGetter__
	(
		"clientY",
		function()
		{
			return this.pageY
		}
	);
	Event.prototype.__defineGetter__
	(
		"keyCode",
		function()
		{
			return this.which
		}
	);
	Event.prototype.__defineSetter__
	(
		"keyCode",
		function(value)
		{
			this.which = value;
	        	return value
		}
	);
	Event.prototype.__defineSetter__
	(
		"returnValue",
		function(value)
		{
	        	if(!value){
	        		this.preventDefault()
	        	}
	        	return value
	        }
	);
	Event.prototype.__defineSetter__
	(
		"cancelBubble",
		function(value)
		{
	        	if(value){
	        		this.stopPropagation()
	        	}
	        	return value
	        }
	);
	Event.prototype.__defineGetter__
	(
		"srcElement",
		function()
		{
			var node=this.target;
			while(node.nodeType!=1){
				node=node.parentNode
			}
			return node
	        }
	);
	Event.prototype.__defineGetter__
	(
		"fromElement",
		function()
		{
			var node;
			if(this.type=="mouseover"){
				node=this.relatedTarget
			}
			else if(this.type=="mouseout"){
				node=this.target
			}
			if(!node){
				return
			}
			while(node.nodeType!=1){
				node=node.parentNode
			}
			return node
	        }
	);
	Event.prototype.__defineGetter__
	(
		"toElement",
		function()
		{
			var node;
			if(this.type=="mouseout"){
				node=this.relatedTarget
			}
			else if(this.type=="mouseover"){
				node=this.target
			}
			if(!node){
				return null
			}
			while(node.nodeType!=1){
				node=node.parentNode
			}
			return node
		}
	);
	Event.prototype.__defineGetter__
	(
		"offsetX",
		function()
		{
			return this.layerX
		}
	);
	Event.prototype.__defineGetter__
	(
		"offsetY",
		function()
		{
			return this.layerY
		}
	);
	Error.prototype.__defineGetter__
	(
		"number",
		function()
		{
			return this.result
		}
	);
	Error.prototype.__defineGetter__
	(
		"description",
		function()
		{
			return this.message
		}
	);
	XMLDocument.prototype.__defineGetter__
	(
		"xml",
		function()
		{
			return (new XMLSerializer).serializeToString(this)
		}
	);
	Element.prototype.__defineGetter__
	(
		"xml",
		function()
		{
			return (new XMLSerializer).serializeToString(this)
		}
	);
	DocumentFragment.prototype.__defineGetter__
	(
		"innerHTML",
		function()
		{
			return (new XMLSerializer).serializeToString(this)
		}
	);
	Node.prototype.__defineGetter__
	(
		"text",
		function()
		{
			return this.textContent
		}
	);
	Node.prototype.__defineSetter__
	(
		"text",
		function(value)
		{
			this.textContent = value;
			return value
		}
	);
	Node.prototype.__defineGetter__
	(
		"value",
		function()
		{
			return this.nodeValue
		}
	);
	Node.prototype.__defineSetter__
	(
		"value",
		function(value)
		{
			this.nodeValue = value;
			return value
		}
	);
	XMLDocument.prototype.loadXML = function(xml)
	{
		var childNodes = this.childNodes;
		for (var i = childNodes.length - 1; i >= 0; i--)
		{
			this.removeChild(childNodes[i])
		}
		var dp = new DOMParser();
		var newDOM = dp.parseFromString(xml, "text/xml");
		var newElt = this.importNode(newDOM.documentElement, true);
		this.appendChild(newElt)
	};
	XMLDocument.prototype.selectNodes = function(xPath,xNode)
	{
		if(!xNode)
		{
			xNode = this
		}
		
		var oNSResolver = this.createNSResolver(this.documentElement);
		var aItems = this.evaluate(xPath, xNode, oNSResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
		var aResult = [];
		for( var i = 0; i < aItems.snapshotLength; i++)
		{
			aResult[i] =  aItems.snapshotItem(i)
		}
		return aResult
	};
	XMLDocument.prototype.selectSingleNode = function(xPath, xNode)
	{
		if( !xNode )
		{
			xNode = this.documentElement
		}
		var xItems = this.selectNodes(xPath, xNode);
		if( xItems.length > 0 )
		{
			return xItems[0]
		}
		else
		{
			return null
		}
	};
	XMLDocument.prototype.transformNode = function(xslDom)
	{
		var xslProc = new XSLTProcessor();
		xslProc.importStylesheet(xslDom);
		var fragment = xslProc.transformToFragment(this, document);
		return fragment.innerHTML
	};
	Element.prototype.selectNodes = function(xPath)
	{
		if(this.XMLDocument)
		{
			return this.XMLDocument.selectNodes(xPath)
		}
		return this.ownerDocument.selectNodes(xPath, this)
	};
	Element.prototype.selectSingleNode = function(xPath)
	{
		if(this.XMLDocument)
		{
			return this.XMLDocument.selectSingleNode(xPath)
		}
		return this.ownerDocument.selectSingleNode(xPath, this)
	};
	if(window.GeckoActiveXObject)
	{
		var ActiveXObject = function(GUID){
			return new window.GeckoActiveXObject(GUID)
		}
	}
} else {
	if(!XMLDocument.prototype.transformNode) {
		XMLDocument.prototype.transformNode = function(xslDom) {
			var xslProc = new XSLTProcessor();
			xslProc.importStylesheet(xslDom);
			var fragment = xslProc.transformToFragment(this, document);
			var output = document.createElement("div");
			output.appendChild(fragment);
			return output.innerHTML;
		};
	}
	try {
		event = new Event();
	}
	catch(ex) {
	}
}
if(!Array.prototype.push){
	Array.prototype.push = function(o){
		this[this.length] = o
	}
}
if(!Function.prototype.apply){
	Function.prototype.apply = function(object, parameters){
		var parameterStrings = new Array();
		if (!object)
		{
			object = window
		}
		if (!parameters)
		{
			parameters = new Array()
		}
		for (var i = 0; i < parameters.length; i++)
		{
			parameterStrings[i] = 'parameters[' + i + ']'
		}
		object.__apply = this;
		var result = eval('object.__apply(' + parameterStrings.join(', ') + ')');
		object.__apply = null;
		return result
	}
}
Function.prototype.bind = function(object){
	var __method = this;
	return function(){
		__method.apply(object, arguments)
	}
}
String.generateGuid = function(){
	var hex = new Array('0','1','2','3','4','5','6','7','8', '9','a','b','c','d','e','f');
	var Guid = "";

	for (count = 0; count < 32; count++)
	{
		if ((count == 8) || (count == 12) || (count == 16) || (count == 20))
		{
			Guid += '-'
		}
		Guid += hex[Math.floor(Math.random() * 16)]
	}
	
	return Guid;
}
String.prototype.parseCDATA = function(){
	return this.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001A\uD800-\uDFFF]/gm,function(c){var code = c.charCodeAt(0);return (code > 9 ? "&#" + code : "&#0" + code) + ";"})
}
String.prototype.parseHTML = function(){
	return this.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")
}
String.prototype.parseText = function(){
	var txt = this.replace(/<br[^>]*>/igm, "\n");
	txt = txt.replace(/<[^>]*>/igm, " ");
	txt = txt.replace(/&nbsp;/igm, " ");
	txt = txt.replace(/&amp;/igm, "&");
	return txt.trim();
}
String.prototype.trim = function(chr){
	return this.trimLeft(chr).trimRight(chr)
}
String.prototype.trimLeft = function(chr)
{
	var reg = /^\s*/g;
	if(chr)
	{
		reg = new RegExp("^" + chr + "*","g")
	}
	return this.replace(reg,"")
}
String.prototype.trimRight = function(chr)
{
	var reg = /\s*$/g;
	if(chr)
	{
		reg = new RegExp(chr + "*$","g")
	}
	return this.replace(reg, "")
}
String.prototype.endsWith = function(s)
{
	return (this.length >= s.length) && (this.substr(this.length - s.length) == s)
}
String.prototype.startsWith = function(s)
{
	return (this.length >= s.length) && (this.substr(0, s.length) == s);
}
String.format = function(s)
{
	for(var i=1; i<arguments.length; i++){
		s = s.replace("{" + (i -1) + "}", arguments[i])
	}
	return s
}
String.prototype.format = function()
{
	var s = this;
	for(var i=0; i<arguments.length; i++){
		s = s.replace(new RegExp("\\{" + i + "\\}","g"), arguments[i])
	}
	return s
}
String.prototype.toObject = function(){
	var o = {};
	var items = this.replace(/&amp;/gi,"__amp;").split('&');
	for(var i = 0;i < items.length;i++)
	{
		var item = items[i].replace(/__amp;/gi,"&amp;").split('=');
		if(item[0] != "")
		{
			o[item[0]] = item[1] || ""
		}
	}
	return o
}
String.prototype.toInt = function(){
	try {
		return eval("0x" + this)
	}
	catch(ex){
		return 0
	}
}
String.prototype.toArray = function(){
	return this.split('');
}
Array.prototype.indexOf = function(value){
	for(var i = 0;i < this.length;i++){
		if(this[i] == value){
			return i
		}
	}
	return -1
}
Array.prototype.removeAt = function(index){
	this.splice(index,1);
}
Array.prototype.remove = function(value){
	var index = this.indexOf(value);
	if(index > -1) {
		this.removeAt(index);
	}
}
Array.prototype.max = function(){
	var max = 0;
	for(var i = 0; i < this.length;i++){
		if(max < this[i]){
			max = this[i]
		}
	}
	return max
}
Array.max = function(arr){return arr.max()};
Array.prototype.min = function(){
	var min = 0;
	for(var i = 0; i < this.length;i++){
		if(min > this[i]){
			min = this[i]
		}
	}
	return min
}
Array.min = function(arr){return arr.min()};
Object.prototype.toQueryString = function(){
	var o = [];
	for(var item in this){
		if(["string","number","boolean","date"].indexOf(typeof(this[item])) > -1 ){
			o.push(item + "=" + this[item])
		}
	}
	return o.join('&')
}
Object.prototype.getOwnPropertys = function() {
	var propertys = [];
	for(var property in this) {
		if(this.hasOwnProperty(property)) {
			propertys.push(this[property]);
		}
	}
	return propertys;
}
Date.timediff = 0;
Date.getServerDateTime = function(){
	var dt = new Date();
	dt.setSeconds(dt.getSeconds() + Date.timediff);
	return dt
}
Date.prototype.format = function(format)
{
	var o = {
		"M+" : this.getMonth()+1,
		"d+" : this.getDate(),
		"h+" : this.getHours(),
		"m+" : this.getMinutes(),
		"s+" : this.getSeconds(),
		"q+" : Math.floor((this.getMonth()+3)/3),
		"S" : this.getMilliseconds()
	};
	if(/(y+)/.test(format))
	{
		format=format.replace(RegExp.$1,(this.getFullYear().toString()).substr(4 - RegExp.$1.length))
	}
	for(var k in o)
	{
		if(new RegExp("("+ k +")").test(format))
		{
			format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length))
		}
	}
	return format
}
window.setStatus = function(stat){
	switch(stat) {
		case 'initialized':
			window.status = "正在传输数据...";
			break;
		case 'loading':
			window.status += ".";
			break;
		case 'loaded':
			window.status = "正在处理...";
			break;
		case 'aborted':
			window.status = "已撤销";
			break;
		case 'done':
			window.status = "完成";
			break;
		default:
			window.status = stat;
			break;
	}
	return true
}
var XmlDocument = function(xml)
{
	var dom = document.createElement("xml");
	if(xml)
	{
		dom.loadXML(xml);
	}
	else
	{
		dom.loadXML('<?xml version="1.0" encoding="utf-8" ?><root />');
	}
	return dom.XMLDocument || dom;
};
var IFrameXmlHttp = new Function();
IFrameXmlHttp.prototype = {
	onreadystatechange: null,
	headers: [],
	method: "POST",
	url: null,
	async: true,
	iframe: null,
	status: 0,
	readyState: 0,
	responseText: null,
	responseXML: null,
	responseContentType:null,
	statusText: null,
	getResponseHeader: function(key) {
		if(key.toLowerCase() == "CONTENT-TYPE")
		{
			return "text/xml";
		}
		return null;
	},
	statechange: function() {
		if(this.iframe.readyState == "complete" || !this.iframe.readyState)
		{
			this.status = 200;
			this.readyState = 4;
			var doc = this.iframe.contentWindow.document;
			
			if(window.isIE && doc.mimeType == "XML Document" || doc.toString() == "[object XMLDocument]")
			{
				this.responseContentType = "text/xml";
				this.responseText = window.isIE ? (doc.XMLDocument.xml) : (new XMLSerializer).serializeToString(doc);
				this.responseXML = window.isIE ? doc.XMLDocument : XmlDocument(this.responseText);
			}
			else
			{
				this.responseContentType = "text/html";
				this.responseText = doc.body.innerHTML;
			}
			this.iframe.onload = this.iframe.onreadystatechange = null;
			document.body.removeChild(this.iframe);
			this.iframe = null;
		}
		else
		{
			switch(this.iframe.readyState)
			{
				case "uninitialized" :
					this.readyState = 0;
					break;
				case "loading" :
					this.readyState = 1;
					break;
				case "loaded" :
					this.readyState = 2;
					break;
				case "interactive" :
					this.readyState = 3;
					break;
			}
		}
		if(this.onreadystatechange)
		{
			this.onreadystatechange();
		}
	},
	open: function(method, url, async) {
		this.iframe = document.createElement('iframe');
		with(this.iframe.style){
			position = 'absolute';
			visibility = 'hidden';
		}
		document.body.appendChild(this.iframe);
		this.iframe.src = "about:blank";
		
		this.iframe.contentWindow.document.write("<html><body></body></html>");

		this.method = method;
		this.url = url;
		this.async = async
	},
	setRequestHeader: function(name, value) {
		for(var i=0; i<this.headers.length; i++) {
			if(this.headers[i].name == name) {
				this.headers[i].value = value;
				return
			}
		}
		this.headers.push({"name":name,"value":value})
	},
	addInput: function(doc, form, name, value) {
		var ele;

		var tag =  value.indexOf("\n") >= 0 ? "textarea" : "input";
		
		if(window.isIE) {
			ele = doc.createElement('<' + tag + ' name="' + name.trimLeft("amp;") + '" />')
		}
		else {
			ele = doc.createElement(tag);
			ele.setAttribute("name", name.trimLeft("amp;"))
		}
  
		ele.value = value;
		form.appendChild(ele);
	},
	addInputArr:  function(doc, form, dominoPara)
	{
		if(!dominoPara)
			return;
			
		var paras = dominoPara.split("&");
		for(var i=0;i<paras.length;i++)
		{
			if(paras[i].indexOf("=") != -1)
			{
				var _input = paras[i].split("=");
				this.addInput(doc, form, _input[0], decodeURIComponent(_input[1]))
			}
		}
	},
	send: function(data) {
		if(this.iframe == null) {
			throw new Error("Create IFrame XMLHTTP Request Object Faild!");
			return;
		}
	
		var doc = this.iframe.contentWindow.document;
		var form = doc.createElement("form");
		
		doc.body.appendChild(form);
		
		form.setAttribute("action", this.url);
		form.setAttribute("method", this.method);
		
		for(var i=0; i<this.headers.length; i++) {

			switch(this.headers[i].name.toLowerCase()) {
				case "content-length":
				case "accept-encoding":
					break;

				case "content-type":
					form.setAttribute("enctype", this.headers[i].value);
					break;
					
				default:
					this.addInput(doc, form, this.headers[i].name, this.headers[i].value);
					break;
			}
		}

		this.addInputArr(doc, form, data);

		form.submit();
		
		this.iframe.onload = this.iframe.onreadystatechange = this.statechange.bind(this);
	},
	abort: function(){
		this.iframe.src = "about:blank";
	}
}
var HTTPRequest = function(async,peaceful,cache)
{
	this.async = (async != false);
	this.peaceful = (peaceful == true);
	this.cache = (cache != false);
	this.processor = null;
	this.aborted = true;
	this.onfailed = null;
	if(window.XMLHttpRequest)
	{
		this.processor = new XMLHttpRequest();
		return;
	}
	else
	{
		var clsids = ["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP.2.6","Msxml2.XMLHTTP","Microsoft.XMLHTTP.1.0","Microsoft.XMLHTTP.1","Microsoft.XMLHTTP"];
		for(var i=0; i<clsids.length; i++)
		{
			try
			{
				this.processor = new ActiveXObject(clsids[i]);
				return;
			}
			catch(ex)
			{
			}
		}
	}
	this.processor = new IFrameXmlHttp();
	throw new Error("浏览器不支持XMLHttpRequest！");
}
HTTPRequest.prototype = {
	send: function(bstrUrl,object,callback,onfailed) {
		var method = object ? "POST" : "GET";
		this.processor.open(method,bstrUrl,this.async);
	
		if(method == "POST")
		{
			this.processor.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded")
		}
		else if(!this.cache)
		{
			this.processor.setRequestHeader("No-Cache","1");
			this.processor.setRequestHeader("Pragma","no-cache");
			this.processor.setRequestHeader("Cache-Control","no-cache");
			this.processor.setRequestHeader("Expire","0");
			this.processor.setRequestHeader("Last-Modified","Wed, 1 Jan 1997 00:00:00 GMT");
			this.processor.setRequestHeader("If-Modified-Since","-1")
		}
		this.aborted = false;
		this.processor.send(object);
		this.callback = callback;
		this.onfailed = onfailed;
		if(this.async)
		{
			this.processor.onreadystatechange = this.statechange.bind(this);
			if(!this.peaceful) {
				window.setStatus("initialized")
			}
			if(this.cache && window.isIE)
			{
				try
				{
					if(this.processor.status == 200 || this.processor.status == 0)
					{
						this.statechange();
					}
				}
				catch(e){}
			}
		}
		else
		{
			this.statechange();
		}
	},
	abort: function() {
		if(!this.aborted)
		{
			this.aborted = true;
			this.processor.abort();
		}
	},
	statechange: function() {
		if( this.aborted ) {
			if(!this.peaceful) {
				window.setStatus("aborted")
			}
			return
		}
		if(!this.peaceful) {
			window.setStatus("loading")
		}
		if(this.processor.readyState == 4)
		{
			this.aborted = true;
			if(this.processor.status == 200 || this.processor.status == 0)
			{
				switch(this.processor.getResponseHeader("Active"))
				{
					case "alert":
						alert(this.getText());
						if(this.onfailed != null) {
							if(typeof(this.onfailed) == "function")
							{
								this.onfailed(this);
							}
							else if(this.onfailed != "")
							{
								eval(this.onfailed);
							}
						}
						break;
					case "eval":
						try {
							eval(this.getText());
						}
						finally {
							if(this.onfailed != null) {
								if(typeof(this.onfailed) == "function")
								{
									this.onfailed(this);
								}
								else if(this.onfailed != "")
								{
									eval(this.onfailed);
								}
							}
						}
						break;
					default:
						if(!this.peaceful) {
							window.setStatus("loaded");
						}
						if(this.callback != null)
						{
							if(typeof(this.callback) == "function")
							{
								this.callback(this);
							}
							else if(this.CallBack != "")
							{
								eval(this.callback);
							}
						}
						break;
				}
				if(!this.peaceful)
				{
					window.setStatus("done");
				}
			}
			else
			{
				if(!this.peaceful) {
					window.setStatus(this.processor.statusText);
				}
			}
		}
	},
	getXML: function() {
		if(this.processor.getResponseHeader("CONTENT-TYPE").toLowerCase().startsWith("text/xml")) {
			return this.processor.responseXML
		}
		else {
			try
			{
				return XmlDocument(this.getText());
			}
			catch(e)
			{
				return this.processor.responseXML;
			}
		}
	},
	getText: function() {
		return this.processor.responseText;
	}
}
var Validator = {
	Account: /^([a-z0-9])+[a-z0-9-_]*([a-z0-9])+$/i,
	Require: /.+/,
	Domain: /^[A-Za-z0-9\-]+$/,
	Email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
	Phone: /^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/,
	Mobile: /^(\+86)?((13)|(15))\d{9}$/,
	Url: /^http(s?):\/\/[\w-]+\.[^\W]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,
	IdCard: /^\d{15}(\d{2}[A-Za-z0-9])?$/,
	Currency: /^\d+(\.\d+)?$/,
	Number: /^\d+$/,
	Zip: /^\d{6}$/,
	QQ: /^[1-9]\d{4,8}$/,
	Integer: /^[-\+]?\d+$/,
	Double: /^[-\+]?\d+(\.\d+)?$/,
	English: /^[A-Za-z]+$/,
	ASCII: /^[\x10-\x80]+$/,
	Chinese: /^[\u0391-\uFFE5]+$/,
	UnSafe: /^(([A-Z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\'\"]*)|.{0,5})$|\s/,
	IsSafe: function(str){return !this.UnSafe.test(str);},
	SafeString: "this.IsSafe(value)",
	Limit: "this.limit(value, getAttribute('min'), getAttribute('max'))",
	Date: "this.IsDate(value, getAttribute('min'), getAttribute('format'))",
	Repeat: "value == form.elements[getAttribute('to')].value",
	Range: "parseInt(getAttribute('min')) <= parseInt(value) && parseInt(value) <= parseInt(getAttribute('max'))",
	Compare: "this.compare(value,getAttribute('operator'),getAttribute('to'))",
	Custom: "this.Exec(value, getAttribute('regexp'))",
	Group: "this.MustChecked(form.elements[getAttribute('name')], getAttribute('min'), getAttribute('max'))",
	ErrorItem: [document.forms[0]],
	ErrorMessage: ["以下原因导致提交失败：\t\t\t\t"],
	Validate: function(theForm, mode)
	{
		var obj = theForm || event.srcElement;
		var count = obj.elements.length;
		this.ErrorMessage.length = 1;
		this.ErrorItem.length = 1;
		this.ErrorItem[0] = obj;
		for(var i=0;i<count;i++)
		{
			with(obj.elements[i])
			{
				if(tagName != "FIELDSET") {
					var _dataType = getAttribute("dataType");
					this.ClearState(obj.elements[i]);
					if(_dataType != "Repeat" && _dataType != "Range" && !this.limit(value,getAttribute('min'), getAttribute('max')))
					{
						this.AddError(i, getAttribute("msg"));
					}
					else
					{
						switch(_dataType){
							case null:break;
							case "Date" :
							case "Repeat" :
							case "Range" :
							case "Compare" :
							case "Custom" :
							case "Group" : 
							case "SafeString" :
							if(!eval(this[_dataType]))
							{
								this.AddError(i, getAttribute("msg"))
							}
							break;
							default :
							if(value.length > 0 && !this[_dataType].test(value))
							{
								this.AddError(i, getAttribute("msg"))
							}
							break;
						}
					}
				}
			}
		}
		if(this.ErrorMessage.length > 1)
		{
			mode = mode || 1;
			var errCount = this.ErrorItem.length;
			switch(mode)
			{
				case 1 :
					alert(this.ErrorMessage.join("\n"));
					this.focus();
					break;
				case 2 :
					for(var i=1;i<errCount;i++)
					{
						this.ErrorItem[i].style.color = "red"
					}
				case 3 :
					for(var i=1;i<errCount;i++)
					{
						try
						{
							var span = document.createElement("SPAN");
							span.id = "__ErrorMessagePanel";
							span.style.color = "red";
							this.ErrorItem[i].parentNode.appendChild(span);
							span.innerHTML = this.ErrorMessage[i].replace(/\d+:/,"*")
						}
						catch(e)
						{
							alert(e.description)
						}
					}
					this.focus();
					break;
				default :
					alert(this.ErrorMessage.join("\n"));
					break;
			}
			return false
		}
		return true
	},
	focus: function() {
		for(var i = 1;i < this.ErrorItem.length;i++) {
			try {
				this.ErrorItem[i].focus();
				return;
			}
			catch(e) {
			}
		}
	},
	limit: function(str,min, max)
	{
		var len= str.replace(/[^\x00-\xff]/g,"**").length;
		min = min || 0;
		max = max || Number.MAX_VALUE;
		return min <= len && len <= max
	},
	ClearState: function(elem)
	{
		with(elem){
			if(style.color == "red")
			{
				style.color = ""
			}
			var lastNode = parentNode.childNodes[parentNode.childNodes.length-1];
			if(lastNode.id == "__ErrorMessagePanel")
			{
				parentNode.removeChild(lastNode)
			}
		}
	},
	AddError: function(index, str)
	{
		this.ErrorItem[this.ErrorItem.length] = this.ErrorItem[0].elements[index];
		this.ErrorMessage[this.ErrorMessage.length] = this.ErrorMessage.length + ":" + str
	},
	Exec: function(op, reg){
		if(typeof(reg) == "string")
		{
			reg = new RegExp(reg)
		}
		return reg.test(op)
	},
	compare: function(op1,operator,op2)
	{
		switch (operator)
		{
			case "NotEqual":
				return (op1 != op2);
			case "GreaterThan":
				return (op1 > op2);
			case "GreaterThanEqual":
				return (op1 >= op2);
			case "LessThan":
				return (op1 < op2);
			case "LessThanEqual":
				return (op1 <= op2);
			default:
				return (op1 == op2); 
		}
	},
	MustChecked: function(groups, min, max)
	{
		if(!groups.length) {
			return groups.checked;
		}
		var hasChecked = 0;
		min = min || 1;
		max = max || groups.length;
		for(var i=groups.length-1;i>=0;i--)
		{
			if(groups[i].checked)
			{
				hasChecked++
			}
		}
		return min <= hasChecked && hasChecked <= max
	},
	IsDate: function(op, formatString)
	{
		formatString = formatString || "ymd";
		var m, year, month, day;
		switch(formatString)
		{
			case "ymd" :
				m = op.match(new RegExp("^((\\d{4})|(\\d{2}))([-./])(\\d{1,2})\\4(\\d{1,2})$"));
				if(m == null)
				{
					return false
				}
				day = m[6];
				month = m[5]*1;
				year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10));
				break;
			case "dmy" :
				m = op.match(new RegExp("^(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))$"));
				if(m == null )
				{
					return false
				}
				day = m[1];
				month = m[3]*1;
				year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10));
				break;
			default :
				break;
		}
		if(!parseInt(month))
		{
			return false
		}
		month = month==0 ? 12:month;
		var date = new Date(year, month - 1, day);
		return (typeof(date) == "object" && year == date.getFullYear() && month == (date.getMonth() + 1) && day == date.getDate());
		function GetFullYear(y){return ((y<30 ? "20" : "19") + y)|0;}
	}
}
var ScriptLoader = {};
ScriptLoader.isLoading = false ;
ScriptLoader.queue = new Array();
ScriptLoader.Load = function(src,handler)
{
	var queue = new Object();
	queue.src = src;
	queue.handler = handler;
	this.queue.push(queue);
	if (!this.isLoading)
	{
		this.CheckQueue()
	}
}
ScriptLoader.CheckQueue = function() 
{
	if ( this.queue.length > 0 )
	{
		this.isLoading = true ;
		this.LoadFile(this.queue.shift())
	}
	else
	{
		this.isLoading = false
	}
}
ScriptLoader.LoadFile = function( queue ) 
{
	var e ;
	if ( queue.src.lastIndexOf('.css') > 0 )
	{
		e = document.createElement('link');
		e.rel = "stylesheet";
		e.type = "text/css";
		if(!window.isIE)
		{
			setTimeout(function(){
				ScriptLoader.CheckQueue();
				if(this.handler) {
					this.handler()
				}
			}.bind(e),1);
		}
	}
	else
	{
		e = document.createElement( "script" );
		e.type = "text/javascript";
		e.handler = queue.handler;
	}
	e.onload = e.onreadystatechange = function() {
		if (!this.readyState || this.readyState == "complete" || this.readyState == 'loaded' )
		{
			if(this.handler) {
				this.handler();
				this.handler = null;
			}
			ScriptLoader.CheckQueue()
		}
	};
	e.href = e.src = queue.src;
	document.getElementsByTagName("head")[0].appendChild( e );
}
var Timer = function(method,delay,loop){
	if(typeof(method) == "string")
	{
		this.method = function(){
			eval(method);
		}
	}
	else if(typeof(method) == "function"){
		this.method = method;
	}
	else{
		return;
	}
	this.method();
	delay = delay || 100;
	loop = (loop || 0) - 1;
	if(loop != 0)
	{	this.loop = loop;
		this.timer = window.setInterval(function(){
			if(this.loop != 0){
				if(!this.paused){
					this.loop--;
					this.loop = Math.max(this.loop,-1);
					this.method();
				}
			}
			else
			{
				window.clearInterval(this.timer);
			}
		}.bind(this),delay);
	}
}
Timer.prototype.pause = function(){
	this.paused = true;
}
Timer.prototype.resume = function(){
	this.paused = false;
}
Timer.prototype.abort = function(){
	this.loop = 0;
}
var Request = {
	Count: 0,
	Initialize: function() {
		this.QueryString = this;
		var queryString = location.href;
		if(queryString.indexOf('?') == -1)
		{
			queryString = queryString.replace(/#/g,'?anchor=')
		}
		else
		{
			queryString = queryString.replace(/#/g,'&anchor=')
		}
		queryString = queryString.split('?');
		if(queryString.length > 1)
		{
			this.QueryString = queryString[1].toObject();
			for(var item in this.QueryString)
			{
				this[item] = decodeURIComponent(this.QueryString[item])
			}
		}
	}
}
Request.Initialize();
var Cookie = {
	set: function(name, value, expires, path, domain, secure) {
		document.cookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
	},
	get: function(name) {
		var dc = document.cookie;
		var prefix = name + "=";
		var begin = dc.indexOf("; " + prefix);
		if (begin == -1) {
			begin = dc.indexOf(prefix);
			if (begin != 0) return null;
		} else {
			begin += 2;
		}
		var end = document.cookie.indexOf(";", begin);
		if (end == -1) {
			end = dc.length;
		}
		return unescape(dc.substring(begin + prefix.length, end));
	},
	remove:function(name)
	{
		var expires=new Date();
		var names = name.split('|');
		for(var i = 0;i < names.length;i++)
		{
			this.set(names[i],"",expires);
		}
	},
	clear:function()
	{
		if(document.cookie=="") return;
		var arr=document.cookie.split("; ");
		if(arr.length)
		{
			var ar;
			for(var i=0;i<arr.length;i++)
			{
				ar=arr[i].split("=");
				if(ar.length)
				{
					this.remove(ar[0]);
				}
			}
		}
	}
}
var Resources = {
	items: {},
	load: function(resource, callback) {
		var xmlhttp = new HTTPRequest();
		xmlhttp.send(resource, null, function(r) {
			this.format(r.getXML());
			if(typeof(callback) == "function") {
				callback(r);
			} else if(typeof(callback) == "string") {
				eval(callback);
			}
		}.bind(this));
		return xmlhttp;
	},
	format: function(dom) {
		var nodes = dom.documentElement.selectNodes("*");
		for(var i = 0;i < nodes.length;i++) {
			this.addResource(this.items, nodes[i]);
		}
	},
	addResource: function(res,node) {
		var id = node.getAttribute("id");
		res = res[id] = {};
		res.id = id;
		res.value = node.getAttribute("name");
		res.items = {};
		var nodes = node.selectNodes("*");
		for(var i = 0;i < nodes.length;i++) {
			this.addResource(res.items,nodes[i]);
		}
	}
}
HTMLElement.prototype.getType = function() {
	switch(this.tagName) {
		case "BUTTON": return HTMLButtonElement;
		case "DIV": return HTMLDivElement;
		case "FORM": return HTMLFormElement;
		case "IFRAME": return HTMLIFrameElement;
		case "IMG": return HTMLImageElement;
		case "INPUT": return HTMLInputElement;
		case "LABEL": return HTMLLabelElement;
		case "OBJECT": return HTMLObjectElement;
		case "SELECT": return HTMLSelectElement;
		case "TABLE": return HTMLTableElement;
		case "THEAD":
		case "TBODY":
		case "TFOOT": return HTMLTableSectionElement;
		case "TR": return HTMLTableRowElement;
		case "TD": return HTMLTableCellElement;
		case "SPAN": return HTMLSpanElement;
		case "TEXTAREA": return HTMLTextAreaElement;
		default: return HTMLUnknownElement;
	}
}
HTMLElement.prototype.getPosition = function() {
	var e = this;
	var pos = {x:0,y:0};
	pos.x = e.offsetLeft;
	pos.y = e.offsetTop;
	while (e = e.offsetParent)
	{
		pos.x += e.offsetLeft;
		pos.y += e.offsetTop;
		if(e.tagName != "HTML"){
			pos.x -= e.scrollLeft;
			pos.y -= e.scrollTop;
		}
	}
	return pos
}
HTMLElement.DragBorder = null;
HTMLElement.prototype.bindDragTo = function(target) {
	this.target = target || this;
	this.onselectstart = function(){
		return false;
	}
	this.style.MozUserSelect = "none";
	if(HTMLElement.DragBorder == null) {
		with(HTMLElement.DragBorder = document.createElement("div")) {
			style.cssText = "cursor:move;position:absolute;border:1px dotted;z-index:999;padding:0px;margin:0px;display:none";
		}
	}
	this.position = {mouse:{x:0,y:0},offset:{top:0,left:0}};

	var onselectstart_eventhandler = function(){
		return event.returnValue = !(event.cancelBubble = true);
	}
	var onmousemove_eventhandler = function(){
		with(HTMLElement.DragBorder.style) {
			top = Math.max(this.position.offset.top + event.clientY - this.position.mouse.y , 0) + "px";
			left = Math.max(this.position.offset.left + event.clientX - this.position.mouse.x, 0) + "px";
			display = "block";
		}
		return event.returnValue = !(event.cancelBubble = true);
	}.bind(this);
	var onmouseup_eventhandler = function() {
		document.detachEvent("onmouseup",onmouseup_eventhandler);
		document.detachEvent("onmousemove",onmousemove_eventhandler);
		document.detachEvent("onselectstart",onselectstart_eventhandler);
		with(this.position) {
			HTMLElement.DragBorder.style.display = "none";
			this.target.style.left = Math.max(offset.left + event.clientX - mouse.x, 0) + "px";
			this.target.style.top = Math.max(offset.top + event.clientY - mouse.y , 0) + "px";
		}
		return event.returnValue = !(event.cancelBubble = true);
	}.bind(this);
	this.attachEvent("onmousedown", function(){
		with(this.position)
		{
			mouse.x = event.clientX;
			mouse.y = event.clientY;
			offset.left = this.target.offsetLeft;
			offset.top = this.target.offsetTop;
		}
		with(HTMLElement.DragBorder.style) {
			width = (this.target.offsetWidth - 6) + "px";
			height = (this.target.offsetHeight - 6) + "px";
		}
		HTMLElement.DragBorder.style.zIndex = 999;
		this.target.insertAdjacentElement("afterEnd", HTMLElement.DragBorder);
		document.attachEvent("onmouseup",onmouseup_eventhandler);
		document.attachEvent("onmousemove",onmousemove_eventhandler);
		document.attachEvent("onselectstart",onselectstart_eventhandler);
	}.bind(this));
}
HTMLElement.prototype.hasClassName = function(className) {
	return this.className.split(/\s+/).indexOf(className) > -1;
}
HTMLElement.prototype.appendClassName = function(className) {
	var cns = this.className.split(/\s+/);
	if(cns.indexOf(className) < 0) {
		cns.push(className);
		this.className = cns.join(' ');
	}
}
HTMLElement.prototype.removeClassName = function(className) {
	var cns = this.className.split(/\s+/);
	cns.remove(className);
	this.className = cns.join(' ');
}
HTMLSelectElement.prototype.fill = function(source,query,textField,valueField,callback)
{
	var httpRequest = new HTTPRequest();
	httpRequest.send(
		source,
		query,
		function(r) {
			var nodes = r.getXML().documentElement.firstChild.childNodes;
			this.options.length = nodes.length;
			for(var i = 0 ; i < nodes.length ; i++)
			{
				this.options[i].text = nodes[i].getAttribute(textField);
				this.options[i].value = nodes[i].getAttribute(valueField)
			}
			this.selectedIndex = 0;
			if(this.onchange) {
				this.onchange();
			}
			if(callback)
			{
				callback(r)
			}
		}.bind(this)
	)
}
HTMLFormElement.prototype.getData = function() {
	if(!Validator.Validate(this))
	{
		return null
	}
	var el,result = [];
	for (var i=0;i< this.elements.length;i++)
	{
		el = this.elements[i];
		if(el.disabled || !el.name)
		{
			continue;
		}
		switch(el.type)
		{
			case "file":
			case "reset":
			case "etc":
			case "submit":
			case "button":
				break;
			case "radio":
			case "checkbox":
				if (el.checked)
				{
					result.push(el.name+"="+encodeURIComponent(el.value))
				}
				break;
			case "select-multiple":
				var optionItem;
				for(var j=0;j<el.options.length;j++)
				{
					optionItem = el.options[j];
					if (optionItem.selected)
					{
						result.push(el.name+"="+encodeURIComponent(optionItem.value))
					}
				}
				break;
			case "textarea":
				el.value = el.value.parseCDATA();
			default: 
				if(el.name)
				{
					result.push(el.name+"="+encodeURIComponent(el.value))
				}
				break;
		}
	}
	return result.join('&')
}
HTMLFormElement.prototype.post = function(callback,onfailed) {
	var query = this.getData();
	if(query != null)
	{
		var httpRequest = new HTTPRequest();
		httpRequest.send(this.action,query,callback,onfailed)
	}
	else if(typeof(onfailed) == "function"){
		onfailed.call(this);
	}
	return query
}
function $id(id)
{
	return document.getElementById(id)
}
function $(source)
{
	if(typeof(source) == "string"){
		source = $id(source)
	}
	if(!source){
		return null
	}
	if(window.isIE && !source.expand)
	{
		for(var item in HTMLElement.prototype) {
			source[item] = HTMLElement.prototype[item]
		}
		var prototype = source.getType().prototype;
		for(var item in prototype)
		{
			source[item] = prototype[item]
		}
		source.expand = true
	}
	return source
}
window.onerror = function() {
	var func=window.onerror.caller;
	var re = /(function\s+)([^\{]*)(\{)([\w\W]*)/mgi;
	var re2 = /(function\s?[^\{]*)(\{)([\w\W]*)/gi;
	var stack = [];
	while(func!=null)
	{
		stack.push(func.toString().replace(re,"$2").replace(re2,"$1"));
		func = func.caller;
	}
	var query = [];
	query.push(arguments[1]);
	query.push(arguments[2]);
	query.push(stack.reverse().join("->").replace(/\s/gi,""));
	query.push(arguments[0]);
	query.push(navigator.userAgent);
	query.push(navigator.cookieEnabled + "\r\n");
	var httpRequest = new HTTPRequest(true,true);
	httpRequest.send("/elog.aspx",query.join("\t"));
}